home *** CD-ROM | disk | FTP | other *** search
- /* bt_util.c - utility functions for BTREE */
- #include "stdio.h"
-
- int clr_mem(p,c,n) /* clear a memory area */
- char *p ; /* start of the memory area */
- int c ; /* value to write there */
- int n ; /* number of bytes to clear */
- {
- while( n > 0 )
- { *p = c ; /* clear current location */
- p = p + 1 ; /* advance pointer */
- n = n - 1 ; /* reduce byte count */
- }
- }
-
- int mover(to,from,nbytes) /* moves bytes allowing for overlap */
- char *to ; /* move the data to here */
- char *from ; /* move it from here */
- int nbytes ; /* number of bytes to move */
- {
- if( from > to )
- {
- while( nbytes > 0 ) /* stop when all bytes moved */
- { *to = *from ; /* move a byte */
- to = to + 1 ; /* advance pointers to and from */
- from = from + 1 ;
- nbytes = nbytes - 1 ; /* reduce bytes left */
- }
- }
- }
-
-